package cn.ecnu.paper.mapper;

import cn.ecnu.paper.pojo.Author;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AuthorMapper {

    @Select("SELECT COUNT(*) FROM author")
    int getAuthorCount();

    @Select("SELECT * FROM author LIMIT #{startNum}, #{pageSize}")
    List<Author> getAuthors(@Param("startNum") int startNum, @Param("pageSize") int pageSize);


    int addAuthor(Author author);

    @Select("SELECT * FROM author")
    List<Author> getAllAuthors();
}
